// pages/buildingDetail/index.js
const app = getApp();
const network = require("../../utils/network.js");
const util = require("../../utils/util.js");
Page({

  /**
   * 页面的初始数据
   */
  data: {
    detail:{
      id: null
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      'detail.id': options.id
    }, function(){
      this.getBuildingDetail();
    })
  },

  getBuildingDetail(){
    util.showLoading('加载中');
    network.GET({
      uri: app.api.buildingDetail,
      params:{id: this.data.detail.id},
      success: (res) => {
        this.setData({
          detail: res.data
        })
      },
      complete: (res) => {
        util.hideLoading();
      }
    })
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})